currentDateTime 
DateTime Sandbox MichS Revised

Finding the Current Date and Time:

Problem
=======

Accessing the current date and time

Solution
========

Using the following function, we can access this date information:

  the_date            : 03/06/2010
  the_time            : 20:37:45
  the_zone            : EST
  the_minute          : 37
  the_second          : 45
  the_name_of_day     : Saturday
  the_hour_twelve     : 08
  the_hour_twentyfour : 20
  the_ampm            : PM
  sun_day_of_week     : 6
  mon_day_of_week     : 6 
  the_month           : 03
  the_name_of_month   : March
  the_day_of_month    : 06
  the_year            : 2010
  the_day_of_year     : 065
  sun_week_of_year    : 09
  mon_week_of_year    : 09

Code 
----

 function demoDateTime() {
      ##-------------------------------------------
      # basic
      print "the_date            : " strftime("%x") 
      print "the_time            : " strftime("%X") 
      print "the_zone            : " strftime("%Z") 
	  #
      ##-------------------------------------------
      ## minutes/secs
      # minute as decimal (00-59)
      print "the_minute          : " strftime("%M") 
      # second of minute as decimal (00-60)
      print "the_second          : " strftime("%S") 
      # 
      ##-------------------------------------------
      ## day/hour
      print "the_name_of_day     : " strftime("%A") 
      print "the_hour_twelve     : " strftime("%I") 
      print "the_hour_twentyfour : " strftime("%H") 
      # locale's equivalent of AM/PM
      print "the_ampm            : " strftime("%p") 
      #
      ##-------------------------------------------
      ## by week
      # weekday as decimal (0-6) starts with Sunday
      print "sun_day_of_week     : " strftime("%w") 
      # weekday as decimal (1-7) starts with Monday
      print "mon_day_of_week     : " strftime("%u") 
      #
      ##-------------------------------------------
      ## by month
      # month as decimal (01-12)
      print "the_month           : " strftime("%m") 
      # locale's full month nam
      print "the_name_of_month   : " strftime("%B") 
      # day of the month as decimal (01-31)
      print "the_day_of_month    : " strftime("%d") 
      #
      ##-------------------------------------------
      ## by year
      # year as decimal (2010)
      print "the_year            : " strftime("%G") 
      # day of the year as decimal (001-366)
      print "the_day_of_year     : " strftime("%j") 
      # week of year (00-53) starts with Sunday
      print "sun_week_of_year    : " strftime("%U") 
      # week of year (01-53) starts with Monday
      print "mon_week_of_year    : " strftime("%V") 
 }

Author
======

Michael Sanders


